//
//  BOSRevealViewController.m
//  LeftDemo
//
//  Created by bosma on 14-4-14.
//  Copyright (c) 2014年 cn.com.bosma. All rights reserved.
//

#import "BOSRevealViewController.h"
#import "SWRevealViewController.h"
#import "BOSBaseViewController.h"
#import "BOSSecondViewController.h"
#import "BOSThirdViewController.h"
#import "BOSFourViewController.h"
#import "BOSSettingViewController.h"
#import "BOSGoalsViewController.h"
#import "BOSSuggestViewController.h"
#import "BOSTopViewController.h"

@interface BOSRevealViewController ()
{
    SWRevealViewController *revealController;
    UIViewController *baseViewController;
    UINavigationController *baseNavigationController;
}
@end

@implementation BOSRevealViewController



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBarHidden = YES;
}

- (void)viewDidLoad
{
	[super viewDidLoad];
    revealController = [self revealViewController];
    baseViewController = revealController.frontViewController;
    baseNavigationController =nil;
    
}

#pragma mark - BtnAction
- (IBAction)FirstBtnAction:(id)sender
{
    NSLog(@"111");
        BOSBaseViewController *baseController = [[BOSBaseViewController alloc] init];
        UINavigationController *baseNav = [[UINavigationController alloc] initWithRootViewController:baseController];
        [revealController pushFrontViewController:baseNav animated:YES];
}

- (IBAction)SecondBtnAction:(id)sender
{
    NSLog(@"222");
    if ( ![baseNavigationController.topViewController isKindOfClass:[BOSSecondViewController class]] )
    {
        BOSSecondViewController *secondViewController = [[BOSSecondViewController alloc] init];
        UINavigationController *secondNav = [[UINavigationController alloc] initWithRootViewController:secondViewController];
        [revealController pushFrontViewController:secondNav animated:YES];
        
    }
    else
    {
        [revealController revealToggleAnimated:YES];
    }
}

- (IBAction)ThirdBtnAction:(id)sender
{
    NSLog(@"333");
    if ( ![baseNavigationController.topViewController isKindOfClass:[BOSThirdViewController class]] )
    {
        BOSThirdViewController *thirdViewController = [[BOSThirdViewController alloc] init];
        UINavigationController *thirdNav = [[UINavigationController alloc] initWithRootViewController:thirdViewController];
        [revealController pushFrontViewController:thirdNav animated:YES];
        
    }
    else
    {
        [revealController revealToggleAnimated:YES];
    }
}

- (IBAction)FourBtnAction:(id)sender
{
    NSLog(@"444");
    if ( ![baseNavigationController.topViewController isKindOfClass:[BOSFourViewController class]] )
    {
        BOSFourViewController *fourViewController = [[BOSFourViewController alloc] init];
        UINavigationController *fourNav = [[UINavigationController alloc] initWithRootViewController:fourViewController];
        [revealController pushFrontViewController:fourNav animated:YES];
        
    }
    else
    {
        [revealController revealToggleAnimated:YES];
    }
}

- (IBAction)SportGoalsAction:(id)sender {
     NSLog(@"运动目标");
    BOSGoalsViewController * goalsViewController = [[BOSGoalsViewController alloc]init];
    UINavigationController * goalsNav = [[UINavigationController alloc]initWithRootViewController:goalsViewController];
    [self.navigationController presentViewController:goalsNav animated:YES completion:nil];
}

- (IBAction)SuggestAction:(id)sender {
     NSLog(@"建议");
    BOSSuggestViewController * suggestViewController = [[BOSSuggestViewController alloc]init];
    UINavigationController * suggestNav = [[UINavigationController alloc]initWithRootViewController:suggestViewController];
    [self.navigationController presentViewController:suggestNav animated:YES completion:nil];
}

- (IBAction)SettingAction:(id)sender {
    NSLog(@"设置");
    BOSSettingViewController * setViewController = [[BOSSettingViewController alloc]init];
    UINavigationController * setNav = [[UINavigationController alloc]initWithRootViewController:setViewController];
    [self.navigationController presentViewController:setNav animated:YES completion:nil];
}



- (IBAction)topBtnAction:(id)sender {
    NSLog(@"点击了");
    BOSTopViewController * topViewController = [[BOSTopViewController alloc]init];
    UINavigationController * topNav = [[UINavigationController alloc]initWithRootViewController:topViewController];
    [self.navigationController presentViewController:topNav animated:YES completion:nil];
    
}
@end
